<?php
namespace app\admin\model;
use think\Model;
use think\Db;
class Cate extends Model{
    public function index(){
        $res = Db::query("select * from category");
        return $res;
    }
    function dels($id)
    {
    	$res=Db::table("category")->where("cat_id='$id'")->delete();
    	return $res;
    }
    function adds($post)
	{
		$data=[
            'cat_name'=>$post['cat_name'],
            'parent_id'=>$post['cat_id'],
            'cat_desc'=>$post['cat_desc'],
            'sort_order'=>$post['sort_order'],
            'cat_num'=>$post['cat_num'],
            'is_show'=>$post['is_show'],
            'show_in_nav'=>$post['show_in_nav']
        ];
       
      $res= Db::table('category')->insert($data);
      return $res;
	}
    function redbao()
    {
        $info = Db::query("select * from redbao");
        return $info;
    }
    function red_del($id)
    {
        $res=Db::table("redbao")->where("red_id='$id'")->delete();
        return $res;
    }
    function addss($post)
    {
        $res=Db::table('redbao')->insert($post);
        return $res;
    }
}



?>